package com.woshengqile.listener;

import net.sf.ehcache.CacheException;
import net.sf.ehcache.Ehcache;
import net.sf.ehcache.Element;
import net.sf.ehcache.event.CacheEventListener;

import com.jfinal.kit.LogKit;

public class MyCacheEventListener implements CacheEventListener  {

	@Override
    public Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
	
	@Override
	public void notifyElementRemoved(Ehcache cache, Element element) throws CacheException {
		String cacheName = cache.getName();
		LogKit.info(">>>>> 缓存【" + cacheName + "】移除 <<<<<");
	}

	@Override
	public void notifyElementPut(Ehcache cache, Element element) throws CacheException {
		String cacheName = cache.getName();
		LogKit.info(">>>>> 缓存【" + cacheName + "】增加 <<<<<");
	}

	@Override
	public void notifyElementUpdated(Ehcache cache, Element element) throws CacheException {
		String cacheName = cache.getName();
		LogKit.info(">>>>> 缓存【" + cacheName + "】更新 <<<<<");
	}

	@Override
	public void notifyElementExpired(Ehcache ehcache, Element element) {
		String cacheName = ehcache.getName();
		LogKit.info(">>>>> 缓存【" + cacheName + "】过期 <<<<<");
	}

	@Override
	public void notifyElementEvicted(Ehcache cache, Element element) {
		String cacheName = cache.getName();
		LogKit.info(">>>>> 缓存【" + cacheName + "】驱逐 <<<<<");
	}

	@Override
	public void notifyRemoveAll(Ehcache cache) {
		String cacheName = cache.getName();
		LogKit.info(">>>>> 缓存【" + cacheName + "】删除 <<<<<");
	}

	@Override
	public void dispose() {
		LogKit.info(">>>>> 缓存处置 <<<<<");
	}

}
